<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>4.清除定时器</title>
    <!-- 
        1.经常给定时器设置别名、标识符
        2.清除定时器后面的参数就是定时器的别名 标识符
     -->
</head>
<body>
    <button>点击停止帅爆了</button>
    <script>
        var timer=setTimeout(function(){
            console.log("帅爆了");
        },5000)
        var btn=document.querySelector('button');
        btn.addEventListener('click',function(){
            clearTimeout(timer);
        })
        
    </script>
    
</body>
</html>